﻿using ReflectionStudio.Core.Events;
using System;
using System.ComponentModel;
using System.Data;
using System.Windows;
using WPFExcelReport.Helpers;
namespace WPFExcelReport
{
    public partial class TSVR05
    { 

        public TSVR05()
        {
            if (DesignerProperties.GetIsInDesignMode(this))
                return;
            MV = new VVRPOS();
            DataContext = MV;
            InitializeComponent();
        }
        public override void vwMaster_CurrentChanged(object sender, System.EventArgs e)
        {
            if (dwMaster!= null)  
            {
               
            }            
        }
        public override void LOADBYVKP(string vkp)
        {
            TBMain.Clear();
            INFO = "";
            if (vkp.Length < 11)
                return;
            dwData = TBMain.NewRow();
            dwData["VRPMANDANT"] = app.Mandant; 
            dwData["VRPSTATIST"] = vkp.Substring(0, 1);
            dwData["VRPAUFKRS"] = vkp.Substring(1, 2);
            dwData["VRPAUFLFD"] = vkp.Substring(3, 6);
            dwData["VRPAUFPOS"] = vkp.Substring(9, 3);
            dwData["VRPZOLLTNR"] = " AND VRPZOLLTNR LIKE '2:%'";
            SResult = TMV.QueryVRPOS(dwData, 4);
            MergeData(SResult,true);
            if (TMV.VRPERLKZ == " ")
            {
                INFO = "未完成";
            }
            else
            {
                INFO = "已完成";
            }
        }
        public override void ManageCommand(object sender, RoutedEventArgs e)
        {
            if (IsManage)
            {
                LOADBYVKP(VKP);
            }
            else
            {
                VICC_WFEVENTS.SVWF.VR02(RUNID, VKP);
            }
            base.ManageCommand(sender, e);
        }
    }
}